package com.dmall.play.interview.chapter09;

public class Leetcode70 {

    public int climbStairs(int n) {
        if (n <= 2) {
            return n;
        }
        int a = 1;
        int b = 2;
        int target = 0;
        for (int i = 3; i <= n; i++) {
            target = a + b;
            a = b;
            b = target;
        }
        return target;
    }

    public static void main(String[] args) {
        Leetcode70 leetcode70 = new Leetcode70();
        System.out.println(leetcode70.climbStairs(40));
    }
}
